package org.example.codetrail.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.codetrail.pojo.Repository;

import java.util.List;

@Mapper
public interface RepoMapper {
    @Insert("insert into repository(user_id,source_platform,source_account,repository_name,repository_url,access_token) values(#{userId},#{sourcePlatform},#{sourceAccount},#{repositoryName},#{repositoryUrl},#{accessToken})")
    void register(Repository repo);
    @Select("select * from repository where repository_url=#{htmlUrl}")
    Repository findByHtmlUrl(String htmlUrl);
    @Select("select * from repository where user_id=#{userId}")
    List<Repository> getLocalRepo(Integer userId);
    @Select("select * from repository where repository_id=#{repositoryId}")
    Repository getLocalRepoInfo(Integer repositoryId);
}
